package view;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import control.CriarGv;

public class Saida {

	private JFrame janela;
	private JPanel painel;
	private Dimension d;
	private Insets i;
	int altura,largura;
	private JLabel text;
	
	public Saida(String string) {
		janela=new JFrame("resultado");
		new Ouvinte(janela);
		painel=new JPanel();
		painel.setBackground(Color.red);
		text=new JLabel(string);
		CriarGv.cria("grafo",string);
		d=Toolkit.getDefaultToolkit().getScreenSize();
		i=Toolkit.getDefaultToolkit().getScreenInsets(janela.getGraphicsConfiguration());
		largura=(d.width-i.left-i.right);
		altura=(d.height-i.top-i.bottom);
		janela.setSize(largura/5,altura/10);
		janela.setLocation(largura/2-janela.getWidth()/2,altura/2-janela.getHeight()/2);
		painel.add(text);
		janela.add(painel);
		janela.setVisible(true);
		janela.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
}
